package cn.edu.scau.cmi.yanghaorui.singleton;

import java.util.ArrayList;
import java.util.List;

public class Marshal {
	private static Marshal instance;
	private String name;
	private static List<String>names=new ArrayList<>();
	private Marshal(String name) {
		this.name=name;
	}
	public static Marshal getInstance(String name) {
		if(!name.equals(null)&&!names.contains(name)&&names.size()!=10) {
			names.add(name);
			instance = new Marshal(name);
			return instance;

		}
		
			return null;
	}
	@Override
	public String toString() {
	return (name+super.toString());
			
	}

}
